@import '../style/theme/color';

:host {
  display: block;
}

.devui-pagination {
  .devui-page-size {
    display: inline-block;
    max-width: 100px;
    vertical-align: middle;
    margin: 0 10px 0 0;
    position: relative;

    &.devui-page-size-sm {
      max-width: 60px;
    }

    &.devui-page-size-lg {
      max-width: 100px;

      li a.devui-pagination-link {
        height: 46px;
        line-height: 46px;
      }
    }
  }

  .devui-total-size {
    display: inline-block;
    position: relative;
    margin: 0 20px 0 0;
    color: $dark-2;
  }

  .devui-pagination-list {
    vertical-align: middle;
    display: inline-flex;
    align-items: center;

    > .disabled > a,
    > .disabled > a:hover,
    > .disabled > a:focus {
      cursor: not-allowed;
    }

    li {
      display: inline;
    }

    li.disabled a {
      color: $disabled-content;

      svg g polygon {
        fill: $disabled-content;
      }
    }

    li.disabled:first-child a,
    li.disabled:last-child a {
      border-color: $disabled-border;
    }

    li:not(.disabled) {
      cursor: pointer;

      a:hover,
      span:hover,
      a:focus,
      span:focus {
        background-color: $hover-content;
        color: $hover-control;
        text-decoration: none; // 覆盖bootStrap默认样式
      }

      a:active {
        background-color: $hwc-color-bg-active;
        color: $font-white;
      }

      &.active a {
        background-color: $hwc-color-bg-active;
        color: $font-white;
        cursor: pointer;

        &:hover {
          background-color: $hover-content;
          color: $hover-control;
        }
      }

      a.devui-pagination-link:hover:not(:active) svg g polygon {
        fill: $hover-control;
      }

      a.devui-pagination-link:active svg g polygon {
        fill: $font-white;
      }
    }

    .devui-pagination-link {
      svg {
        vertical-align: middle;

        g polygon {
          fill: $dark-1;
        }
      }
    }

    .devui-pagination-link-lite {
      border: 1px solid transparent !important;
      border-radius: 2px;
    }
  }

  .devui-pagination-list > li > a {
    margin-left: 5px;
    padding: 3px 7px;
    line-height: 1.5;
    border-radius: 2px;
    color: $dark-2;
    display: flex;
    align-items: center;
  }

  .devui-pagination-sm > li > a {
    padding: 2px 6px;
    line-height: 1.5;
    font-size: 12px;
  }

  .devui-pagination-lg > li > a {
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1.5;
  }

  .devui-pagination-list > li:first-child > a,
  .devui-pagination-list > li:last-child > a {
    padding: 7px 11px;
    height: 32px;
    line-height: 32px;
  }

  .devui-pagination-sm > li:first-child > a,
  .devui-pagination-sm > li:last-child > a {
    border-radius: 2px;
    height: 30px;
    line-height: 30px;
  }

  .devui-pagination-sm > li:first-child > a {
    padding: 6px 5px 6px 3px;
  }

  .devui-pagination-sm > li:last-child > a {
    padding: 6px 3px 6px 5px;
  }

  .devui-pagination-lg > li:first-child > a,
  .devui-pagination-lg > li:last-child > a {
    padding: 13px 16px;
    border-radius: 2px;
    height: 46px;
    line-height: 46px;
  }

  .devui-jump-container {
    display: inline-block;
    position: relative;
    margin: 0 10px 0 10px;
    vertical-align: middle;

    .devui-input {
      display: inline-block;
      width: 3.5em;
      vertical-align: middle;
    }
  }

  .devui-jump-button {
    display: inline-block;
    vertical-align: middle;
    border-radius: 1px;
    border: 1px solid $gray-1;
    cursor: pointer;
    margin-left: 5px;

    .devui-pagination-go {
      width: 0;
      height: 0;
      border-top-style: solid;
      border-left-style: solid;
      border-bottom-style: solid;
    }

    &:hover {
      border-color: $hover-control;

      .devui-pagination-go {
        border-left-color: $hover-control;
      }
    }
  }

  .devui-jump-size-default {
    width: 34px;
    height: 34px;

    .devui-pagination-go {
      width: 0;
      height: 0;
      border-top: 12px solid transparent;
      border-left: 12px solid $dark-2;
      border-bottom: 12px solid transparent;
      margin: 4px auto;
    }
  }

  .devui-jump-size-sm {
    width: 24px;
    height: 24px;

    .devui-pagination-go {
      width: 0;
      height: 0;
      border-top: 6px solid transparent;
      border-left: 6px solid $dark-2;
      border-bottom: 6px solid transparent;
      margin: 5px auto;
    }

    .devui-pagination-link {
      height: 30px;
      line-height: 32px;
    }
  }

  .devui-jump-size-lg {
    width: 46px;
    height: 46px;

    .devui-pagination-go {
      width: 0;
      height: 0;
      border-top: 16px solid transparent;
      border-left: 16px solid $dark-2;
      border-bottom: 16px solid transparent;
      margin: 6px auto;
    }
  }

  .devui-lite-paginator {
    display: inline-block;
    margin-right: 5px;
    width: 100px;
  }

  .devui-pagination-config {
    color: $dark-1;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin: 0 5px;

    .devui-setup-icon {
      line-height: 30px;
      cursor: pointer;
      display: flex;

      svg g path {
        fill: $dark-1;
      }
    }

    .devui-config-container {
      padding: 5px 0;
      box-shadow: 0 0 6px 1px $dark-1-boxshadow;
      border-radius: 2px;
      width: 150px;
      background-color: $bg-white;
      line-height: 26px;
      position: absolute;
      left: -136px;
      top: 28px;
      cursor: auto;
      z-index: 1000;
      -moz-user-select: none;
      -webkit-user-select: none;
      -ms-user-select: none;
      user-select: none;

      .devui-pagination-config-item.devui-page-size-config {
        border-bottom: none;
      }

      .devui-pagination-config-item {
        padding-bottom: 8px;
        padding-top: 5px;
        border-bottom: 1px solid $gray-2;

        .devui-config-item-title {
          color: $dark-2;
          padding-left: 10px;
          font-size: 12px;
          line-height: 22px;
        }

        .devui-page-number {
          padding-left: 10px;
          margin-top: 4px;
          display: flex;
          display: -ms-flexbox;

          div {
            color: $dark-1;
            cursor: pointer;
            border-top: 1px solid $gray-1;
            border-bottom: 1px solid $gray-1;
            border-right: 1px solid $gray-1;
            text-align: center;
            height: 26px;
            width: 26px;
          }

          div:hover {
            background-color: $hover-content;
            color: $hover-control;
          }

          div:first-child {
            border-left: 1px solid $gray-1;
          }

          .devui-page-number div.choosed,
          .choosed {
            &:not(:hover):not(:active) {
              color: $font-white;
              background-color: $hwc-color-bg-active !important;
              cursor: auto !important;
            }
          }
        }
      }
    }
  }
}

:host ::ng-deep .devui-input-sm {
  height: 24px;
  padding: 5px 5px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 2px;
}

:host ::ng-deep .devui-input-lg {
  height: 46px;
}
